{if $full_page}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户列表</title>
<link rel="stylesheet" href="Res/boot/css/bootstrap.min.css" type="text/css" media="screen" />
<link rel="stylesheet" href="Res/boot/css/bootstrap-theme.min.css" type="text/css" media="screen" />
<script type="text/javascript" src="Res/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="Res/js/jquery.cookie.js"></script>
<script type="text/javascript" src="Res/boot/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Res/js/listTable.js"></script>
<link rel="stylesheet" href="Res/css/page.css" type="text/css" />
<link rel="stylesheet" href="Res/css/global.css" type="text/css" />
{literal}
<style>
    .listDiv{margin:0 auto;}  
    table tbody td lable:hover{background-color:#00E8D7}
</style>
{/literal}
</head>
<body>
<div class="container-fluid">
	<div class="row-fluid">
            <div class="span12 panel panel-info">                
                <span class="cp_title">用户管理</span>
                <div class="add_cp">
                        <a href="index.php?c=user&m=create">+添加用户</a>
                </div>	
                <div class="panel-heading">
                    <label for="action_code">用户名称:</label>
                    <input class="input-medium search-query" id="user_name" name="action_code" type="text" placeholder="用户名称" />   
                    
                    <label for="action_url">邮箱:</label>
                    <input class="input-medium search-query" id="email" name="action_url" type="text" placeholder="邮箱" />   
                    
                    <button type="button" id="btn_search" class="btn btn-success">查找</button>                        
                </div>
 
                <div class="listDiv" id="listDiv">
{/if}
                <table id="data_table_id" class="table table-hover table-bordered">
                    <thead>
                    <tr>                        
                        <th>ID</th>
                        <th>用户名</th>
                        <th>邮箱</th>
                        <th>过期时间</th>
                        <th>是否启用</th>
                        <th>加入时间</th>
                        <th>最后登陆时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>    
                        {foreach from=$data.pageData item=row}
                        <tr>
                            <td>{$row.id}</td>
                            <td>{$row.user_name}</td>
                            <td><lable onclick="listTable.edit(this, 'edit_fields', {$row.user_id}, 'email')" title="点击修改">{$row.email}</lable></td>
                            <td>{$row.end_time}</td>
                            <td style="text-align:center;">
                                <span class="glyphicon {$row.is_use}" style="cursor:pointer;font-size: 16px;line-height: 28px;" onclick="listTable.toggle(this, {$row.user_id}, 'is_use')"></span>
                            </td>
                            <td>{$row.in_time_format}</td>
                            <td>{$row.last_time_format}</td>
                            <td style="text-align:center;">          
                                <button class="btn btn-info" type="button" onclick="allot({$row.user_id})" >
                                    <span class="glyphicon glyphicon-cog"></span>
                                </button>
                                <button class="btn btn-info"  type="button" onclick="edit({$row.user_id})">  
                                    <span class="glyphicon glyphicon-pencil"></span>
                                </button>
                                <button class="btn btn-info" type="button" onclick="del({$row.user_id})">
                                    <span class="glyphicon glyphicon-trash"></span>
                                </button>
                                {if $isadmin eq 1}
                                <button class="btn btn-info" type="button" onclick="unlink({$row.user_id})">
                                    <span class="glyphicon glyphicon-remove-circle"></span>
                                </button> 
                                {/if}
                            </td>
                        </tr>
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <!-- 分页数据 -->
                        <tr>
                            <td colspan="8"><div class="iPageHtml">{$data.pageHtml}</div></td>
                        </tr>
                    </tfoot>
                </table>
              
{if $full_page}
                </div>
            </div>
	</div>
</div>
<div style="clear:both;"></div>
{literal}
<script type="text/javascript">
    listTable.m = 'query';
    listTable.divid = 'listDiv';
    $("#btn_search").click(function(){
        listTable.filter['page'] =1;
        listTable.filter['user_name'] = $("#user_name").val();
        listTable.filter['email'] = $("#email").val();
        listTable.loadList();
    });
    function allot(id) {
        var url = "index.php?c=action&m=allot&user_id=" + id;
        window.location.href = url;
    }
    function edit(id) {
        var url = "index.php?c=user&m=edit&user_id=" + id;
        window.location.href = url;
    }
    function del(id) {
        var params = new Object();
        params.user_id = id;
        params.ajax = 1;
        $.post('index.php?c=user&m=del', params, function(data) {
            if(data.status == 0) {
                alert(data.msg)
            } else {
                alert(data.msg);
            }
        }, 'json');
    }
    function unlink(id){//真删除
        var params = new Object();
        params.user_id = id;
        params.ajax = 1;
        $.post('index.php?c=user&m=unlink', params, function(data) {
            if(data.status == 0) {
                alert(data.msg)
            } else {
                alert(data.msg);
            }
        }, 'json');
    }
</script>
{/literal}
</body>
</html>
{/if}